package com.sun;

import java.lang.reflect.Field;
import java.util.*;
public class Main {
    public static void main(String[] args) throws IllegalAccessException {
        Studnet studnet = new Studnet();
        studnet.name = "sxt";
        studnet.email = "1791540641@qq.com";
        studnet.money =10000000;
        studnet.setAge(25);
        for (Field field : studnet.getClass().getDeclaredFields()) {
            field.setAccessible(true);
            if (field.getName().equals("name")){
                field.set(studnet,"sunXueTen");
            }
            Object o = field.get(studnet);
            System.out.println(field.getName() +":" + o);
        }
    }
}

class Studnet{//static 不可以修饰普通类，可以修饰内部类
    private Integer age;//本类
    public  String name; //本类 同包 子类 任意位置
    String email;//本类 同包
    protected Integer money;//本类 同包 子类

    public Integer getAge() {
        return age;
    }

    public void setAge(Integer age) {
        this.age = age;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public Integer getMoney() {
        return money;
    }

    public void setMoney(Integer money) {
        this.money = money;
    }
}
